<!--
 * @Author: 亚亚
-->
<!--
 * @Author: 亚亚
-->
<!--
 * @Author: 亚亚
-->
<!--
 * @Author: 亚亚
-->
<template>
  <el-select v-model="currentVal" v-bind="$attrs" :style="props.style">
    <el-option
      v-for="item in props.options"
      :label="item[props.props.label || 'label']"
      :value="item[props.props.value || 'value']"
      :disabled="item.disabled"
    />
  </el-select>
</template>

<script lang="ts" setup>
import { props as selectProps } from './index'
const props = defineProps(selectProps)
const emit = defineEmits(['update:modelValue'])
const currentVal = ref(props.modelValue)

//监听父组件的值
watch(() => props.modelValue, () => {
  currentVal.value = props.modelValue
})
// 通过emit将值传递给父组件
emit("update:modelValue", currentVal)
</script>